package edu.scnu.fans.fingertip.user.api;

import edu.scnu.fans.fingertip.common.api.ApiResponse;
import edu.scnu.fans.fingertip.common.api.HeaderConstant;
import edu.scnu.fans.fingertip.common.api.IdRequest;
import edu.scnu.fans.fingertip.user.input.UserAddressDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import javax.validation.Valid;

/**
 * 用户地址 Feign 微服务调用接口
 */
@FeignClient("fingertip-user")
public interface UserAddressApi {

    @PostMapping("/fingertip/user/address/v1/findAddressById")
    @ApiOperation("根据id查找收货地址")
    ApiResponse<UserAddressDto> findAddressById(@RequestHeader(HeaderConstant.USER_ID) Long userId,
                                                @RequestBody @Valid IdRequest input);

}
